package com.xuelang.pipeline.domain.pipeline.service.imp;

import com.xuelang.pipeline.client.common.result.PageRecord;
import com.xuelang.pipeline.client.pipeline.dto.DeploymentUnitQuery;
import com.xuelang.pipeline.domain.pipeline.DeploymentUnit;
import com.xuelang.pipeline.domain.pipeline.repository.DeploymentUnitRepository;
import com.xuelang.pipeline.domain.pipeline.service.DeploymentUnitDomainService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>部署单域服务实现类</p>
 *
 * @author : yixin.lys
 * @date : 2024-06-25 16:36
 **/
@Slf4j
@Service
public class DeploymentUnitDomainServiceImpl implements DeploymentUnitDomainService {

    @Autowired
    private DeploymentUnitRepository repository;

    @Override
    public PageRecord<DeploymentUnit> pageByCondition(long currentPage, long pageSize, DeploymentUnitQuery condition) {
        return repository.pageByCondition(currentPage, pageSize, condition);
    }

    @Override
    public void add(DeploymentUnit deploymentUnit) {
        repository.add(deploymentUnit);
    }

    @Override
    public void update(DeploymentUnit deploymentUnit) {
        repository.update(deploymentUnit);
    }

    @Override
    public DeploymentUnit queryByPipelineInstanceCode(String pipelineInstanceCode) {
        return repository.queryByPipelineInstanceCode(pipelineInstanceCode);
    }

    @Override
    public void removeByIds(List<String> idList) {
        repository.removeByIds(idList);
    }

    @Override
    public void removeByCodes(List<String> codeList) {
        repository.removeByCodes(codeList);
    }

    @Override
    public DeploymentUnit queryById(String id) {
        return repository.queryById(id);
    }
}
